<template>
  <el-form :model="form" label-width="170px" :show-message="false" ref="form" :rules="rules" :inline="true">
    <div style="border: 2px solid #999999; padding: 10px 10px;margin-bottom: 10px">
      <el-form-item label="保险过期前进入商机：">
        <el-input  placeholder="请输入天数" style="width: 130px;" oninput="value=value.replace(/[^0-9]/g,'')" clearable v-model="form.insuranceExpire"></el-input><span style="margin-left: 15px">天</span>
      </el-form-item>
      <el-form-item label="年审过期前进入商机：">
        <el-input  placeholder="请输入天数" style="width: 130px;" oninput="value=value.replace(/[^0-9]/g,'')" clearable v-model="form.yearExpire"></el-input><span style="margin-left: 15px">天</span>
      </el-form-item>
      <el-form-item label="保养过期前进入商机：">
        <el-input  placeholder="请输入天数" style="width: 130px;" oninput="value=value.replace(/[^0-9]/g,'')" clearable v-model="form.maintenanceExpire"></el-input><span style="margin-left: 15px">天</span>
      </el-form-item>
      <el-row>
        <span>设置对应的商机提醒时间，如车辆保险过期多少天前进入商机列表，车辆年审到期多少天前进入商机列表，保养到期多少
          天前进入商机列表。</span>
      </el-row>
    </div>
    <el-row>
      <el-col :span="24" align="center">
        <el-form-item>
          <el-button type="primary" style="border: 0;width: 100px" @click="onSubmit">保存</el-button>
        </el-form-item>
      </el-col>
    </el-row>
  </el-form>
</template>

<script>
  import { getStoreId } from '@/utils'
  export default {
    name: 'BusinessSetForm',
    props: {
      value: {
        type: Object,
        default: () => ({
        })
      }
    },
    data() {
      return {
        dict: {},
        form: {
          insuranceExpire: '',
          yearExpire: '',
          maintenanceExpire: '',
          storeId: ''
        },
        rules: {
          followUpTime: [{ required: true, trigger: 'change' }],
          remark: [{ required: true, trigger: 'blur' }]

        }
      }
    },
    created() {
      let storeId = getStoreId()
      this.form.storeId = storeId
    },
    methods: {
      onSubmit() {
        this.$refs.form.validate(valid => {
          if (valid) {
            const options = this.form
            this.$emit('operate', options)
          } else {
            return false
          }
        })
      }
    }
  }
</script>
<style lang="scss" scoped>
</style>

